package com.cytangaa.display;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;

import com.cytanaa.youlike.R;

public class PendingView {
	private View pendingView = null;
	Context context;
	
	public PendingView (Context context){
		this.context = context;
	}
	
	public View getPendingView() {
		View row = LayoutInflater.from(context).inflate(
				R.layout.row, null);

		pendingView = row.findViewById(android.R.id.text1);
		pendingView.setVisibility(View.GONE);
		pendingView = row.findViewById(R.id.throbber);
		pendingView.setVisibility(View.VISIBLE);
		startProgressAnimation();

		return (row);
	}
	void startProgressAnimation() {
		if (pendingView != null) {
			RotateAnimation rotate = null;
			rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF,
					0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
			rotate.setDuration(600);
			rotate.setRepeatMode(Animation.RESTART);
			rotate.setRepeatCount(Animation.INFINITE);
			pendingView.startAnimation(rotate);
		}
	}

}
